$(function() {
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

    /**
     *  @author Think
     *  Description:  许可编辑
     *  @date  21:13 2018-05-26
     */
    $("#form-lisence-update").validate({
        rules: {
            orgCode: {
                required: true,
            },
            userName: {
                required: false,
                minlength: 2,
                maxlength: 10
            },
            passWord: {
                required: false,
                minlength: 3,
                maxlength: 16
            },
            count: {
                required: true,
                digits: true
            }
        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler:function(form){

            var id = $("#id").val();
            var orgCode = $("#orgCode").val();
            var userName = $("#userName").val();
            var passWord = $("#passWord").val();
            var authenName = $("#authenName").val();
            var authenPwd = $("#authenPwd").val();
            var count = $("#count").val();

            var params = {id:id,orgCode:orgCode,userName:userName,passWord:passWord,authenName:authenName,authenPwd:authenPwd,count:count};
            $.ajax({
                type: "POST",
                url: '/authorize/updateLisence',
                dataType : "json",
                data: params,
                success: function (data) {
                    if (data.success == true) {
                        layer.msg(data.msg,{icon:1,time:2000},function(){
                            parent.location.reload();
                        });
                    } else if(data.success == false){
                        layer.msg(data.msg,{icon:2,time:4000});
                        return;
                    }
                }
            });
        }
    });
});